package com.prototype;

import com.prototype.cache.ShapeCache;
import com.prototype.kind.Shape;

public class Test {
    public static void main(String[] args) {
        // 模拟系统初始化所有缓存
        ShapeCache.loadCache();

        /*
            生成各实例的克隆对象，通过实现序列化接口支持深拷贝
         */
        Shape clonedShape = (Shape) ShapeCache.getShape(1);
        System.out.println("Shape : " + clonedShape.getType() + ", hashCode=" + clonedShape.hashCode());

        Shape clonedShape2 = (Shape) ShapeCache.getShape(2);
        System.out.println("Shape : " + clonedShape2.getType() + ", hashCode=" + clonedShape2.hashCode());

        Shape clonedShape3 = (Shape) ShapeCache.getShape(3);
        System.out.println("Shape : " + clonedShape3.getType() + ", hashCode=" + clonedShape3.hashCode());

        Shape clonedShape3_new = (Shape) ShapeCache.getShape(3);
        System.out.println("Shape : " + clonedShape3_new.getType() + ", hashCode=" + clonedShape3_new.hashCode());

    }
}
